<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="<%=request.getContextPath()%>/css/pc/login.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="<%=request.getContextPath()%>/js/pc/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/pc/login.js"></script>
<title>找回密码</title>
</head>
<body>
	  <!--
        	作者：offline
        	时间：2016-12-28
        	描述：找回密码(新页面)
        -->
        <div class="login3">
        	<div class="login3_div1">
        		<img src="<%=request.getContextPath()%>/images/pc/logos_01.jpg" />
        	</div>
        	<img class="login3_img1" src="<%=request.getContextPath()%>/images/pc/login_02.jpg" />
        	<div class="page_divs" id="reminder_back"></div>
        	<input class="login3_in1" type="text" placeholder="注册邮箱" id="username_back" value=""/>
        	<input class="login3_in2" type="button" value="找回密码" onclick="checkEmail()"/>
        	<a class="login3_a1" href="javascript:login()">想起密码去登录></a>
        </div>
        <!--   登录   -->
      	<%@include file="../login/login.jsp"%>
      	<!--   注册   -->
      	<%@include file="../login/register.jsp"%>
</body>
<script type="text/javascript">
	//登录提交验证
	function checkEmail(){
		  var username_back=$("#username_back").val();
		  var index3=/^([a-zA-Z0-9_\.\-]+)@([a-zA-Z0-9_\.\-]+)\.[c]{1}[o]{1}[m]{1}$/;
		  if(username_back==""){
			  $("#reminder_back").html("请输入注册邮箱");
			  $("#username_back").focus();
			  return false;
		  }else if(!index3.test(username_back)){
			  $("#reminder_back").html("邮箱格式不正确");
			  $("#username_back").focus();
			  return false;
		  }
		  var check=0;
			 //验证邮箱重复
			  $.ajax({
		          type: "POST",
		          url: "<%=request.getContextPath()%>/login/checksamename.htm",
				data : {
					pc_username : username_back
				},
				dataType : "json",
				async: false,
				success : function(data) {
					if (data.state > 0) {
						check=1;
					}else{
						$("#reminder_back").html("该邮箱没有被注册");
						return false;
					}
				},
				error : function(error) {
					alert("err");
				}
			});
		  
		  if(check==1){
			//提交
			document.write('<form action="<%=request.getContextPath()%>/login/backpwd.htm" method="post" name="formx1" style="display:none">');
			document.write('<input type="hidden" name="emailcount" value="'+username_back+'"/>');
			document.write("</form>");
			document.formx1.submit();
		  } 
	}
	//登录
	function login(){
		$(".login").css({"display":"inline-block"});
		$(".login2").css({"display":"none"});
	}
	//注册
	function register(){
		$(".login2").css({"display":"inline-block"});
		$(".login").css({"display":"none"});
	}
</script>
</html>